TraffEduObject Class Reference

#include <TraffEduObject.h>

Inheritance diagram for TraffEduObject:

EnvironmentObject Path TrafficLight TrafficSign Vehicle Wheel List of all members.

Public Member Functions

virtual void draw (osg::ref_ptr< osg::Group > root, int animationFlag=-1)=0
void addTree (osg::ref_ptr< osg::Group > root, int animationFlag=-1)
osg::PositionAttitudeTransform * getPAT ()
void setScale (float x, float y, float z)
void setPosition (float x, float y, float z)
void setRotate (float x, float y, float z, float axis)
osg::Vec3d getScale ()
osg::Vec3d getPosition ()
osg::Quat getRotate ()
char getCondition ()
void setCondition (char chr)
int getObjectId ()
void setObjectId ()
int getIsBeforeCreated ()
void setModelPath (string str)
string getModelPath ()
void resetModelPath (string str)
void hide (osg::ref_ptr< osg::Group > root)
void display (osg::ref_ptr< osg::Group > root, int animationFlag=-1)
void setObjectType (ObjectType type)
ObjectType getObjectType ()
void setModelScale (float scale)
float getModelScale ()
double getm_drotz ()
osg::ref_ptr< osg::Node > returnNode ()
osg::ref_ptr< osg::Node > returnNode (int i)
osg::ref_ptr< osg::PositionAttitudeTransform > getObjectPAT ()
void setInAnimation (int i)
int objectPATvectorSize ()
void setIsBeforeCreated (int flag)
vector< vehiclePAT * > & getObjectPATvector ()
void resetObjectId ()
osg::ref_ptr< osg::Group > getObjectGroup ()
 TraffEduObject ()
 TraffEduObject (string modelpath, float scalevalue)
 ~TraffEduObject ()
int addObjectPAT (int i)
int deleteObjectPAT (int i)
osg::ref_ptr< osg::PositionAttitudeTransform > reloadObjectPAT ()
void setAsPhysicalVehicle ()
bool isPhysicalVehicle ()
void setCameraFollow ()
bool isCameraFollow ()
void resetCameraFollow ()
void undoPhysicalVehicle ()

Protected Member Functions

void sortObjectPATvector ()
int returnIndex (int)

Protected Attributes

ObjectType type
int objectId
int viewMode
string modelPath
osg::ref_ptr< osg::PositionAttitudeTransform > objectPAT
vector< vehiclePAT * > objectPATvector
float modelScale
char condition
int isBeforeCreated
int inAnimation
double m_drotz
int cameraFollow
osg::ref_ptr< osg::Group > objectGroup
osg::ref_ptr< osg::Geometry > objectGeometry
osg::ref_ptr< osg::Geode > objectGeode
osg::ref_ptr< osg::Node > node
int physicalVehicle

Detailed Description

Definition at line 18 of file TraffEduObject.h.


Constructor & Destructor Documentation

TraffEduObject::TraffEduObject (   ) 
 

TraffEduObject constructor

Definition at line 11 of file TraffEduObject.cpp.

References cameraFollow, condition, isBeforeCreated, m_drotz, objectGeode, objectGeometry, objectGroup, objectPAT, physicalVehicle, and viewMode.

TraffEduObject::TraffEduObject (  string  modelpath,
float  scalevalue
) 
 

TraffEduObject constructor

Parameters:
modelpath 
scalevalue 

Definition at line 34 of file TraffEduObject.cpp.

References cameraFollow, condition, isBeforeCreated, objectGeode, objectGeometry, objectGroup, objectPAT, physicalVehicle, setModelPath(), setModelScale(), and viewMode.

TraffEduObject::~TraffEduObject (   ) 
 

TraffEduObject destructor

Definition at line 57 of file TraffEduObject.cpp.


Member Function Documentation

int TraffEduObject::addObjectPAT (  int  i  ) 
 

addObjectPAT

Parameters:
i Add the corresponding PAT, objectGeode and ObjectGroup to the objectPAT

Definition at line 336 of file TraffEduObject.cpp.

References vehiclePATstruct::frameID, OSGWindows::getFrames(), objectGeode, objectGroup, objectPAT, vehiclePATstruct::objectPAT, objectPATvector, osgwind, returnIndex(), OSGWindows::returnIndex(), OSGWindows::sizeOfFrames(), sortObjectPATvector(), type, and VEHICLE.

void TraffEduObject::addTree (  osg::ref_ptr< osg::Group >  root,
int  animationFlag = -1
) 
 

Parameters:
root 
animationFlag The PAT of the objects are added to the root for drawing then in the scene.

Definition at line 62 of file TraffEduObject.cpp.

References OSGWindows::getCurrentFrameId(), objectPAT, objectPATvector, osgwind, OSGWindows::returnIndex(), type, and VEHICLE.

Referenced by Wheel::draw(), Vehicle::draw(), TrafficSign::draw(), TrafficLight::draw(), Path::draw(), and EnvironmentObject::draw().

int TraffEduObject::deleteObjectPAT (  int  i  ) 
 

deleteObjectPAT

Parameters:
i Delete the corresponding PAT, from the objectPAT

Definition at line 375 of file TraffEduObject.cpp.

References OSGWindows::getConstantRoot(), objectPAT, objectPATvector, osgwind, type, and VEHICLE.

void TraffEduObject::display (  osg::ref_ptr< osg::Group >  root,
int  animationFlag = -1
) 
 

Inserts the object to the root if it is hidden.

Parameters:
root 
animationFlag 

Definition at line 216 of file TraffEduObject.cpp.

References OSGWindows::getCurrentFrameId(), objectPAT, objectPATvector, osgwind, OSGWindows::returnIndex(), type, VEHICLE, and viewMode.

Referenced by Vehicle::displayPath().

virtual void TraffEduObject::draw (  osg::ref_ptr< osg::Group >  root,
int  animationFlag = -1
)  [pure virtual]
 

Parameters:
root 
animationFlag 

Implemented in EnvironmentObject, Path, TrafficLight, TrafficSign, Vehicle, and Wheel.

char TraffEduObject::getCondition (   ) 
 

Returns:
The condition of the object as deleted or not deleted

Definition at line 286 of file TraffEduObject.cpp.

References condition.

int TraffEduObject::getIsBeforeCreated (   ) 
 

Returns:
Whether the object is drawn before.

Definition at line 307 of file TraffEduObject.cpp.

References isBeforeCreated.

Referenced by OSGWindows::doAddGeode().

double TraffEduObject::getm_drotz (   )  [inline]
 

Returns:
the rotation value in z coordinates

Definition at line 224 of file TraffEduObject.h.

References m_drotz.

string TraffEduObject::getModelPath (   ) 
 

Returns:
Gets the path of the model of the object

Definition at line 250 of file TraffEduObject.cpp.

References modelPath.

float TraffEduObject::getModelScale (   ) 
 

Returns:
The scale factor of the model

Definition at line 276 of file TraffEduObject.cpp.

References modelScale.

osg::ref_ptr<osg::Group> TraffEduObject::getObjectGroup (   )  [inline]
 

Definition at line 270 of file TraffEduObject.h.

References objectGroup.

Referenced by CommandInsertEnvObj::CommandInsertEnvObj(), CommandInsertTrafficLight::CommandInsertTrafficLight(), CommandInsertTrafficSign::CommandInsertTrafficSign(), CommandInsertVehicle::CommandInsertVehicle(), and CommandPaste::CommandPaste().

int TraffEduObject::getObjectId (   ) 
 

Returns:
Gets the id of the objects

Definition at line 291 of file TraffEduObject.cpp.

References objectId.

Referenced by OSGWindows::doAddGeode(), OSGWindows::doDeleteGeode(), and OSGWindows::dropUnselectedObject().

osg::ref_ptr< osg::PositionAttitudeTransform > TraffEduObject::getObjectPAT (   ) 
 

Returns:
The osg::PositionAttitudeTransform matrix of the object

Definition at line 303 of file TraffEduObject.cpp.

References objectPAT.

Referenced by CarPhysics::odeDraw(), OtherPhysicalObjects::setCollusion(), and OtherPhysicalObjects::update().

vector< vehiclePAT * > & TraffEduObject::getObjectPATvector (   ) 
 

Returns:
The vehiclePAT pointer vector of the object.

Definition at line 431 of file TraffEduObject.cpp.

References objectPATvector.

Referenced by createAnimationPath(), AnimationWindow::createControlPoints(), and CarPhysics::mySetPosition().

ObjectType TraffEduObject::getObjectType (   ) 
 

Returns:
The type of the object

Definition at line 268 of file TraffEduObject.cpp.

References type.

Referenced by AnimationWindow::addOtherPhysicalObject(), OSGWindows::dropUnselectedObject(), and OtherPhysicalObjects::update().

osg::PositionAttitudeTransform * TraffEduObject::getPAT (   ) 
 

Returns:
The PAT of the object

Definition at line 180 of file TraffEduObject.cpp.

References OSGWindows::getCurrentFrameId(), objectPAT, objectPATvector, osgwind, OSGWindows::returnIndex(), type, and VEHICLE.

Referenced by OSGEventHandler::drag().

osg::Vec3d TraffEduObject::getPosition (   ) 
 

Returns:
position values in 3 coordinates

Definition at line 151 of file TraffEduObject.cpp.

References OSGWindows::getCurrentFrameId(), objectPAT, objectPATvector, osgwind, OSGWindows::returnIndex(), type, and VEHICLE.

osg::Quat TraffEduObject::getRotate (   ) 
 

Returns:
rotation values in 3 coordinates

Definition at line 165 of file TraffEduObject.cpp.

References OSGWindows::getCurrentFrameId(), objectPAT, objectPATvector, osgwind, OSGWindows::returnIndex(), type, and VEHICLE.

osg::Vec3d TraffEduObject::getScale (   ) 
 

Returns:
scale values in 3 coordinates

Definition at line 137 of file TraffEduObject.cpp.

References OSGWindows::getCurrentFrameId(), objectPAT, objectPATvector, osgwind, OSGWindows::returnIndex(), type, and VEHICLE.

Referenced by createAnimationPath().

void TraffEduObject::hide (  osg::ref_ptr< osg::Group >  root  ) 
 

hide function

Parameters:
root Remove the object from the root if it is displayed.

Definition at line 194 of file TraffEduObject.cpp.

References objectPAT, objectPATvector, type, VEHICLE, and viewMode.

Referenced by Vehicle::hidePath().

bool TraffEduObject::isCameraFollow (   ) 
 

isCameraFollow

Returns:
Whether the camera is set to follow a vehicle

Definition at line 458 of file TraffEduObject.cpp.

References cameraFollow.

bool TraffEduObject::isPhysicalVehicle (   ) 
 

Returns:
true if vehicle is a physical vehicle

Definition at line 438 of file TraffEduObject.cpp.

References physicalVehicle.

int TraffEduObject::objectPATvectorSize (   ) 
 

Returns:
Size of the objectPATvector.

Definition at line 428 of file TraffEduObject.cpp.

References objectPATvector.

Referenced by AnimationWindow::createControlPoints().

osg::ref_ptr< osg::PositionAttitudeTransform > TraffEduObject::reloadObjectPAT (   ) 
 

Returns:
osg::ref_ptr<osg::PositionAttitudeTransform> set objectPAT the same as the objectPAT<of the first frame

Definition at line 407 of file TraffEduObject.cpp.

References objectPAT, objectPATvector, and sortObjectPATvector().

void TraffEduObject::resetCameraFollow (   ) 
 

resetCameraFollow sets the bool variable cameraFollow to 0.

Definition at line 461 of file TraffEduObject.cpp.

References cameraFollow.

Referenced by AnimationWindow::exit().

void TraffEduObject::resetModelPath (  string  str  ) 
 

setModelPath function

Parameters:
str Resets the path of the model of the object

Definition at line 311 of file TraffEduObject.cpp.

References modelPath, and setModelPath().

Referenced by Vehicle::reload(), and Vehicle::setWheels().

void TraffEduObject::resetObjectId (   ) 
 

sets objectId to 0.

Definition at line 442 of file TraffEduObject.cpp.

References ObjectIDs.

int TraffEduObject::returnIndex (  int   )  [protected]
 

Definition at line 446 of file TraffEduObject.cpp.

References objectPATvector.

Referenced by addObjectPAT().

osg::ref_ptr< osg::Node > TraffEduObject::returnNode (  int  i  ) 
 

Parameters:
i int returns The node that the vehicle model is added

Definition at line 259 of file TraffEduObject.cpp.

References node, and CarModels::returnModel().

osg::ref_ptr< osg::Node > TraffEduObject::returnNode (   ) 
 

Returns:
The node that the vehicle model is added

Definition at line 254 of file TraffEduObject.cpp.

References modelPath, and node.

Referenced by Wheel::draw(), Vehicle::draw(), EnvironmentObject::draw(), and Vehicle::reload().

void TraffEduObject::setAsPhysicalVehicle (   ) 
 

sets the variable that determines whether the vehicle needs a corresponding physical vehicle

Definition at line 434 of file TraffEduObject.cpp.

References physicalVehicle, type, and VEHICLE.

void TraffEduObject::setCameraFollow (   ) 
 

SetCameraFollow sets the bool variable cameraFollow to 1.

Definition at line 455 of file TraffEduObject.cpp.

References cameraFollow.

void TraffEduObject::setCondition (  char  chr  ) 
 

Parameters:
chr sets the condition as deleted when parameter is 'd' or normal when parameter is 'a'

Definition at line 280 of file TraffEduObject.cpp.

References condition.

void TraffEduObject::setInAnimation (  int  i  ) 
 

Parameters:
i int Assigns inAnimation member to the function parameter

Definition at line 420 of file TraffEduObject.cpp.

References inAnimation.

Referenced by AnimationWindow::exit().

void TraffEduObject::setIsBeforeCreated (  int  flag  )  [inline]
 

Definition at line 249 of file TraffEduObject.h.

References isBeforeCreated.

void TraffEduObject::setModelPath (  string  str  ) 
 

Parameters:
str string sets the path of the model of the object

Definition at line 245 of file TraffEduObject.cpp.

References modelPath.

Referenced by resetModelPath(), Vehicle::setWheels(), and TraffEduObject().

void TraffEduObject::setModelScale (  float  scale  ) 
 

Sets the scale factor of the model

Parameters:
scale 

Definition at line 272 of file TraffEduObject.cpp.

References modelScale.

Referenced by Vehicle::setWheels(), and TraffEduObject().

void TraffEduObject::setObjectId (   ) 
 

sets the id of the objects

Definition at line 296 of file TraffEduObject.cpp.

References objectId, and ObjectIDs.

Referenced by EnvironmentObject::EnvironmentObject(), TrafficLight::TrafficLight(), and TrafficSign::TrafficSign().

void TraffEduObject::setObjectType (  ObjectType  type  ) 
 

sets the type of the object to the objectType field

Parameters:
type objecttype sets the type of the object to the objectType field

Definition at line 264 of file TraffEduObject.cpp.

References type.

Referenced by EnvironmentObject::EnvironmentObject(), TrafficLight::TrafficLight(), TrafficSign::TrafficSign(), Vehicle::Vehicle(), and Wheel::Wheel().

void TraffEduObject::setPosition (  float  x,
float  y,
float  z
) 
 

Parameters:
x position in x coordinates
y position in y coordinates
z position in z coordinates set the position values to the PAT of the object.

Definition at line 107 of file TraffEduObject.cpp.

References OSGWindows::getCurrentFrameId(), objectPAT, objectPATvector, osgwind, OSGWindows::returnIndex(), type, and VEHICLE.

Referenced by CommandInsertEnvObj::CommandInsertEnvObj(), CommandInsertTrafficLight::CommandInsertTrafficLight(), CommandInsertTrafficSign::CommandInsertTrafficSign(), CommandInsertVehicle::CommandInsertVehicle(), and CommandPaste::CommandPaste().

void TraffEduObject::setRotate (  float  x,
float  y,
float  z,
float  axis
) 
 

Parameters:
x rotation in x coordinates
y rotation in y coordinates
z rotation in z coordinates
axis rotation axis set the position values to the PAT of the object.

Definition at line 89 of file TraffEduObject.cpp.

References OSGWindows::getCurrentFrameId(), m_drotz, objectPAT, objectPATvector, osgwind, OSGWindows::returnIndex(), type, and VEHICLE.

void TraffEduObject::setScale (  float  x,
float  y,
float  z
) 
 

Parameters:
x scale value in x coordinates
y scale value in y coordinates
z scale value in z coordinates set the scale values to the PAT of the object.

Definition at line 122 of file TraffEduObject.cpp.

References OSGWindows::getCurrentFrameId(), objectPAT, objectPATvector, osgwind, OSGWindows::returnIndex(), type, and VEHICLE.

Referenced by CommandInsertTrafficLight::CommandInsertTrafficLight(), CommandInsertTrafficSign::CommandInsertTrafficSign(), CommandPaste::CommandPaste(), Wheel::draw(), Vehicle::draw(), EnvironmentObject::draw(), and Vehicle::reload().

void TraffEduObject::sortObjectPATvector (   )  [protected]
 

sorts the elements in the PAT vector according to the frame numbers.

Definition at line 390 of file TraffEduObject.cpp.

References objectPATvector.

Referenced by addObjectPAT(), and reloadObjectPAT().

void TraffEduObject::undoPhysicalVehicle (   ) 
 

undoPhysicalVehicle sets the bool variable physicalVehicle to 0.

Definition at line 464 of file TraffEduObject.cpp.

References physicalVehicle.

Referenced by AnimationWindow::exit().


Member Data Documentation

int TraffEduObject::cameraFollow [protected]
 

variable that keeps the boolean value for whether the camera will follow it or not.

Definition at line 78 of file TraffEduObject.h.

Referenced by isCameraFollow(), resetCameraFollow(), setCameraFollow(), and TraffEduObject().

char TraffEduObject::condition [protected]
 

variable that keeps the condition of the object.

Definition at line 57 of file TraffEduObject.h.

Referenced by getCondition(), setCondition(), and TraffEduObject().

int TraffEduObject::inAnimation [protected]
 

variable that keeps the boolean value for whether the object is in animation or not.

Definition at line 68 of file TraffEduObject.h.

Referenced by setInAnimation().

int TraffEduObject::isBeforeCreated [protected]
 

variable that keeps the boolean value of whet it is drawn or not.

Definition at line 62 of file TraffEduObject.h.

Referenced by Vehicle::draw(), TrafficSign::draw(), EnvironmentObject::draw(), getIsBeforeCreated(), setIsBeforeCreated(), and TraffEduObject().

double TraffEduObject::m_drotz [protected]
 

variable that keeps the rotation angle in z coordinates of the object.

Definition at line 73 of file TraffEduObject.h.

Referenced by getm_drotz(), setRotate(), and TraffEduObject().

string TraffEduObject::modelPath [protected]
 

variable that keeps the path of the model of the object.

Definition at line 37 of file TraffEduObject.h.

Referenced by Vehicle::draw(), TrafficSign::draw(), getModelPath(), resetModelPath(), returnNode(), setModelPath(), Vehicle::setWheels(), and TrafficSign::TrafficSign().

float TraffEduObject::modelScale [protected]
 

variable that keeps the scale factor of the object.

Definition at line 52 of file TraffEduObject.h.

Referenced by Wheel::draw(), Vehicle::draw(), EnvironmentObject::draw(), getModelScale(), Vehicle::reload(), setModelScale(), and Vehicle::setWheels().

osg::ref_ptr<osg::Node> TraffEduObject::node [protected]
 

Definition at line 262 of file TraffEduObject.h.

Referenced by returnNode().

osg::ref_ptr<osg::Geode> TraffEduObject::objectGeode [protected]
 

Definition at line 261 of file TraffEduObject.h.

Referenced by addObjectPAT(), TraffEduObject(), and Vehicle::Vehicle().

osg::ref_ptr<osg::Geometry> TraffEduObject::objectGeometry [protected]
 

Definition at line 260 of file TraffEduObject.h.

Referenced by TraffEduObject().

osg::ref_ptr<osg::Group> TraffEduObject::objectGroup [protected]
 

Definition at line 259 of file TraffEduObject.h.

Referenced by addObjectPAT(), TrafficLight::changeColor(), TrafficLight::changeColorAnim(), Wheel::draw(), Vehicle::draw(), TrafficSign::draw(), TrafficLight::draw(), EnvironmentObject::draw(), EnvironmentObject::EnvironmentObject(), getObjectGroup(), Vehicle::reload(), TraffEduObject(), TrafficLight::TrafficLight(), TrafficSign::TrafficSign(), and Vehicle::Vehicle().

int TraffEduObject::objectId [protected]
 

variable that keeps the id of the object

Definition at line 27 of file TraffEduObject.h.

Referenced by getObjectId(), and setObjectId().

osg::ref_ptr<osg::PositionAttitudeTransform> TraffEduObject::objectPAT [protected]
 

variable that keeps the PositionAttitudeTransform of the model of the object.

Definition at line 42 of file TraffEduObject.h.

Referenced by addObjectPAT(), addTree(), deleteObjectPAT(), display(), Path::draw(), getObjectPAT(), getPAT(), getPosition(), getRotate(), getScale(), hide(), Vehicle::reload(), reloadObjectPAT(), setPosition(), setRotate(), setScale(), TraffEduObject(), and Vehicle::Vehicle().

vector<vehiclePAT *> TraffEduObject::objectPATvector [protected]
 

variable that keeps the vector of PositionAttitudeTransform of the model of the object.

Definition at line 47 of file TraffEduObject.h.

Referenced by addObjectPAT(), addTree(), deleteObjectPAT(), display(), getObjectPATvector(), getPAT(), getPosition(), getRotate(), getScale(), hide(), objectPATvectorSize(), reloadObjectPAT(), returnIndex(), setPosition(), setRotate(), setScale(), sortObjectPATvector(), and Vehicle::Vehicle().

int TraffEduObject::physicalVehicle [protected]
 

Definition at line 267 of file TraffEduObject.h.

Referenced by isPhysicalVehicle(), setAsPhysicalVehicle(), TraffEduObject(), and undoPhysicalVehicle().

ObjectType TraffEduObject::type [protected]
 

variable that keeps the type of the object

Definition at line 23 of file TraffEduObject.h.

Referenced by addObjectPAT(), addTree(), deleteObjectPAT(), display(), getObjectType(), getPAT(), getPosition(), getRotate(), getScale(), hide(), setAsPhysicalVehicle(), setObjectType(), setPosition(), setRotate(), and setScale().

int TraffEduObject::viewMode [protected]
 

variable that keeps the viewMode of the object; hide or display property.

Definition at line 32 of file TraffEduObject.h.

Referenced by display(), Vehicle::draw(), TrafficSign::draw(), EnvironmentObject::draw(), hide(), and TraffEduObject().


The documentation for this class was generated from the following files:
Generated on Sun May 28 18:54:15 2006 for TraffEdu by  doxygen 1.4.6-NO